{%-macro Combination(schema)-%}
    {%-if 'allOf' in schema-%}
        allOf
    {%-elif 'anyOf' in schema-%}
        anyOf
    {%-endif-%}
{%-endmacro-%}

{%-macro GetImports(resolver, schema, includes)-%}
{%-do includes.append('from __future__ import annotations')-%}
{%-if schema.oneOf is defined-%}
{%-    do includes.append('from collections import UserDict')-%}
{%-    for comp in schema['oneOf']-%}
{%-        if '$ref' in comp-%}
{%-            do includes.append(resolver.py_include_statement(comp['$ref']))-%}
{%-        else-%}
{{            GetImports(resolver, comp, includes)}}
{%-        endif-%}
{%-    endfor-%}
{%-elif schema.allOf is defined-%}
{%-    for comp in schema[Combination(schema)]-%}
{%-        if '$ref' in comp-%}
{%-            do includes.append(resolver.py_include_statement(comp['$ref']))-%}
{%-        else-%}
{{            GetImports(resolver, comp, includes)}}
{%-        endif-%}
{%-    endfor-%}
{%-elif schema.anyOf is defined-%}
{%-    do includes.append('from collections import UserDict')-%}
{%-    for comp in schema[Combination(schema)]-%}
{%-        if '$ref' in comp-%}
{%-        do includes.append(resolver.py_include_statement(comp['$ref']))-%}
{%-        endif-%}
{%-    endfor-%}
{%-    for comp in schema[Combination(schema)]-%}
{%-        if '$ref' not in comp-%}
{{            GetImports(resolver, comp, includes)}}
{%-        endif-%}
{%-    endfor-%}
{%-elif '$ref' in schema-%}
{# This object makes use of an external schema specified at {{schema['$ref']}}#}
{%-elif 'type' not in schema-%}
{%-elif schema.type == 'integer'
or schema.type == 'number'
or schema.type == 'boolean'
or schema.type == 'string'-%}
{%-    if schema.pattern is defined-%}
{%-        do includes.append('import re')-%}
{%-    endif-%}
{%-elif schema.type == 'array'-%}
{%-    do includes.append('from collections import UserList')-%}
{%-        if 'items' in schema-%}
{%-            if '$ref' in schema['items']-%}
{%-                do includes.append(resolver.py_include_statement(schema['items']['$ref']))-%}
{%-            endif-%}
{%-        endif-%}
{%-    if 'items' in schema-%}
{%-        if '$ref' not in schema['items']-%}
{%-            set itemType = 'self.Item'-%}
{{            GetImports(resolver, schema['items'], includes)}}
{%-        endif-%}
{%-    endif-%}
{%-elif schema.type == 'object'-%}
{%-    do includes.append('from collections import UserDict')-%}
{%-    for prop in schema.properties.values()-%}
{%-        if '$ref' in prop-%}
{%-            do includes.append(resolver.py_include_statement(prop['$ref']))-%}
{%-        endif%}
{%-    endfor%}
{%-    for propName, propSchema in schema.properties.items()-%}
{%-        if '$ref' not in prop-%}
{{            GetImports(resolver, propSchema, includes)}}
{%-        endif-%}
{%-    endfor%}
{%-elif schema.type == 'null'-%}
{#     Nothing special here #}
{%-elif schema.type == 'string'-%}
{%-    if schema.pattern is defined-%}
{%-        do includes.append('import re')-%}
{%-    endif-%}
{%-else-%}
{%-endif-%}
{%-endmacro-%}